package com.aaa.service.impl;

import com.aaa.dao.DynastyDao;
import com.aaa.entity.Dynasty;
import com.aaa.service.DynastyService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DynastyServiceImpl implements DynastyService {
    @Autowired
    DynastyDao dd;
    @Override
    public PageInfo findDynasty(String dynName,int page,int size) {
        PageHelper.startPage(page,size); //仅需要前后加上这两句即可
        List<Dynasty> list= dd.findDynasty(dynName);
        return new PageInfo(list);
    }

    public List<Dynasty> findAllDynasty() {
        return dd.findDynasty(null);
    }
}
